<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>登录</title>
    <link rel="stylesheet" href="css/style.css">
    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.form.js"></script>
    <script src="js/requestUrl.js"></script>
    <style>
        html,
        body {
            min-height: 0 !important;
        }

        .tab_content {
            width: 300px;
            margin: 0 auto;
        }
    </style>
</head>

<body style="padding-bottom: 0 !important;">
    <!-- <div class="longinput">
<div>原手机号：</div>
<input type="text" name="" id="">
</div>
<div class="longinput">
<div>新手机号：</div>
<input type="text" name="" id="">
</div>
<div class="shortinput">
<div>验证码：</div>
<input type="text" name="" id="">
</div> -->
    <div class="tab_content">
        <ul>
            <li class="tabs" style="">
                <div class="input">
                    <dl>
                        <input type="password" class="password password1" value="" name="tel" placeholder="请输入旧密码">
                    </dl>
                    <dl>
                        <input type="password" class="password password2" name="smsCode" value="" placeholder="请输入新密码">
                    </dl>
                    <dl>
                        <input type="password" class="password password3" value="" name="tel" placeholder="请再次输入新密码">
                    </dl>
                    <button class="login_btn login_btn2">修改</button>
                </div>
            </li>
        </ul>
    </div>


</body>
<script src="js/layer/layer.js"></script>
<script>
    $('.login_btn2').click(function () {
        var password1 = $(".password1").val();
        var password2 = $(".password2").val();
        var password3 = $(".password3").val();
        if ($(".password1").val() == "" || $(".password1").val() == undefined) {
            layer.msg('请输入旧密码')
            return false;
        } else if ($(".password2").val() == "" || $(".password2").val() == undefined) {
            layer.msg('请输入新密码')
            return false;
        } else if ($(".password3").val() == "" || $(".password3").val() == undefined) {
            layer.msg('请再次输入新密码')
            return false;
        }
        myAjax('/user/updatePassword', {
                oldPassword: password1,
                newPassword: password2,
                confirmPassword: password3
            },
            function (data) {
                if (data.msg == "您当前暂未登录，请登录后在操作") {
                    layer.alert(data.msg, {
                        title: "提示",
                        cancel: function () {
                            window.location.href =
                                "http://newtest.sdfa.org.cn/footballAssociation/zuxie/login.html"
                        }
                    }, function () {
                        window.location.href =
                            "http://newtest.sdfa.org.cn/footballAssociation/zuxie/login.html"
                    });
                    return false
                }
                if (data.msg == "0") {
                    layer.alert('修改成功', {
                        title: '提示',
                        cancel: function () {
                            var index = parent.parent.layer.getFrameIndex(window
                                .name); //先得到当前iframe层的索引
                            parent.parent.document.querySelector(".logout").click() //再执行关闭  
                        }
                    }, function () {
                        var index = parent.parent.layer.getFrameIndex(window
                            .name); //先得到当前iframe层的索引
                        parent.parent.document.querySelector(".logout").click() //再执行关闭  
                    })
                } else {
                    layer.alert(data.msg, {
                        title: '提示'
                    })
                }
            },
            function (err) {
                console.log(err)
            })
    });
</script>

</html>